(function(){
	'use strict';
	angular.module('services.workOrderData.eventMgmt')
	.factory('eventStatisticFactory',eventStatisticFactory);
	function eventStatisticFactory(Restangular,workOrderDataService){
		return {
			query:query,
			fmtOption: fmtOption,
			getShortName: getShortName
		};
		function query(param,callback){
			Restangular.all('sas/workOrderData/eventMgmt/query').post(param).then(callback);
		}
		function fmtOption(code,option){
			if(code === 'h2001' || code === 'h2002' || code === 'h2003'){
				option.tooltip.formatter = workOrderDataService.getFormatterFn('个');
				option.yAxis[0] = workOrderDataService.formatterYAxis('单位:(个)','');
			}else if(code === 'h2004' || code === 'h2005' || code === 'h2006'){
				option.tooltip.formatter = workOrderDataService.getFormatterFn('小时');
				option.yAxis[0] = workOrderDataService.formatterYAxis('单位:(小时)','');
			}else {
				option.tooltip.formatter = workOrderDataService.getFormatterFn('%');
				option.yAxis[0] = workOrderDataService.formatterYAxis('','{value}%');
			}
		}
		function getShortName(send){
			var smallName = '' ;
			var code = send.measureIndexCode;
			if(code === 'h2001' || code === 'h2002' || code === 'h2003'){
				smallName = '各科室';
			}else {
				smallName = '各业务系统';
			}
			return smallName;
		}
	}
})();